package ooDay03;

public class RefArrayDemo {
    public static void main(String[] args) {

        Chick[] chicks = new Chick[2];
        Fish[] fishs = new  Fish[4];

        Dog[] dogs =new Dog[3];
        dogs[0] = new Dog("小黑",2,"黑");
        dogs[1] = new Dog("小白",1,"白");
        dogs[2] = new Dog("小黄",3,"黄");
        System.out.println(dogs);
        System.out.println(dogs[0]);

        chicks[0] = new Chick("小金",1,"金");
        chicks[1] = new Chick("小彩",2,"彩");

        for (Chick chick : chicks){
            System.out.println(chick.name);
            chick.layEggs();
        }

        fishs[0] = new Fish("小金",2,"金");
        fishs[1] = new Fish("小彩",2,"彩");
        fishs[2] = new Fish("小绿",1,"绿");
        fishs[3] = new Fish("小白",3,"白");
        for(int i =0;i<fishs.length;i++){
            fishs[i].swim();
        }
    }
}
